package cn.lovefix.org.service.impl;

import cn.lovefix.base.pageList;
import cn.lovefix.org.domain.Movie;
import cn.lovefix.org.mapper.MovieMapper;
import cn.lovefix.org.query.queryByname;
import cn.lovefix.org.service.MovieService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class MovieServiceImpl implements MovieService {
    @Autowired
    private MovieMapper movieMapper;
    @Override
    public List<Movie> findAll() {
        return movieMapper.findAll();
    }

    @Override
    public void del(Long mId) {
        movieMapper.del(mId);

    }

    @Override
    public void update(Movie movie) {
        movieMapper.update(movie);

    }

    @Override
    public void add(Movie movie) {
        movieMapper.add(movie);

    }

    @Override
    public pageList<Movie> query(queryByname query){
        Integer totals = movieMapper.queryBycount(query);
        List<Movie> list = movieMapper.query(query);
        pageList<Movie> pageList = new pageList<>(totals, list);

        return pageList;
    }
}
